using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Mark.Models;

/// <summary>
/// 对话实体
/// </summary>
public class Conversation : BaseEntity
{
    [Required]
    [MaxLength(200)]
    public string Title { get; set; } = string.Empty;
    
    [MaxLength(1000)]
    public string? Description { get; set; }
    
    /// <summary>
    /// 对话配置 (JSON)
    /// </summary>
    public string? Config { get; set; }
    
    /// <summary>
    /// 对话状态：Active, Archived, Deleted
    /// </summary>
    [MaxLength(20)]
    public string Status { get; set; } = "Active";
    
    /// <summary>
    /// 是否置顶
    /// </summary>
    public bool IsPinned { get; set; } = false;
    
    /// <summary>
    /// 最后活动时间
    /// </summary>
    public DateTime LastActivityAt { get; set; } = DateTime.UtcNow;
    
    /// <summary>
    /// 消息计数
    /// </summary>
    public int MessageCount { get; set; } = 0;
    
    // 外键
    [Required]
    public string UserId { get; set; } = string.Empty;
    
    // 导航属性
    [ForeignKey("UserId")]
    public virtual User User { get; set; } = null!;
    
    public virtual ICollection<Message> Messages { get; set; } = new List<Message>();
} 